package nccloud.pubimpl.so.delivery.operator;

import java.util.HashSet;
import java.util.Set;
import nc.vo.so.m4331.entity.DeliveryVO;
import nc.vo.so.pub.SOConstant;
import nccloud.dto.scmpub.pub.event.rule.AbstractBodyAfterHandler;
import nccloud.dto.scmpub.pub.event.rule.IBodyAfterRule;
import nccloud.pubimpl.so.delivery.event.body.CalculateAfterRule;
import nccloud.pubimpl.so.delivery.event.body.EmployeeAfterRule;
import nccloud.pubimpl.so.delivery.event.body.InStockAfterRule;
import nccloud.pubimpl.so.delivery.event.body.InStockOrgAfterRule;
import nccloud.pubimpl.so.delivery.event.body.MaterialAfterRule;
import nccloud.pubimpl.so.delivery.event.body.RProfitAfterRule;
import nccloud.pubimpl.so.delivery.event.body.ReceiveAddAfterRule;
import nccloud.pubimpl.so.delivery.event.body.ReceiveCustAfterRule;
import nccloud.pubimpl.so.delivery.event.body.SProfitAfterRule;
import nccloud.pubimpl.so.delivery.event.body.SendStockAfterRule;
import nccloud.pubimpl.so.delivery.event.body.SendStockOrgAfterRule;
import nccloud.pubimpl.so.delivery.event.body.SettleOrgEditRule;
import nccloud.pubimpl.so.delivery.event.body.UnitAfterRule;











public class DeliveryBodyEventHandler
  extends AbstractBodyAfterHandler
{
  protected IBodyAfterRule<DeliveryVO> getAfterRule(String changeKey) {
    IBodyAfterRule<DeliveryVO> rule = null;
    
    if ("cmaterialvid".equals(changeKey)) {
      
      rule = new MaterialAfterRule();
    } else if ("castunitid".equals(changeKey)) {
      
      rule = new UnitAfterRule();
    } else if ("csendstockorgvid".equals(changeKey)) {
      
      rule = new SendStockOrgAfterRule();
    } else if ("cinstockorgvid".equals(changeKey)) {
      
      rule = new InStockOrgAfterRule();
    } else if ("creceiveaddrid".equals(changeKey)) {
      
      rule = new ReceiveAddAfterRule();
    } else if ("creceivecustvid".equals(changeKey) || "creceivecustid".equals(changeKey)) {
      
      rule = new ReceiveCustAfterRule();
    } else if ("cinstordocid".equals(changeKey)) {
      
      rule = new InStockAfterRule();
    } else if ("csendstordocid".equals(changeKey)) {
      
      rule = new SendStockAfterRule();
    } else if ("csprofitcentervid".equals(changeKey)) {
      
      rule = new SProfitAfterRule();
    } else if ("crprofitcentervid".equals(changeKey)) {
      
      rule = new RProfitAfterRule();
    } else if ("cemployeeid".equals(changeKey)) {
      
      rule = new EmployeeAfterRule();
    } else if (getNeedCalKey().contains(changeKey)) {
      
      rule = new CalculateAfterRule();
    } else if ("csettleorgvid".equals(changeKey)) {
      
      rule = new SettleOrgEditRule();
    } 
    return rule;
  }







  
  private Set<String> getNeedCalKey() {
    Set<String> hsNeedCalKey = new HashSet<String>();
    for (String key : SOConstant.STRNEEDCALKEY) {
      hsNeedCalKey.add(key);
    }
    return hsNeedCalKey;
  }
}
